﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResetPwdFrm.aspx.cs" Inherits="WebApp.ResetPwdFrm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>重置密码</title>
    <link rel="stylesheet" type="text/css" href="css/newStyle.css" />
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.3.2/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.3.2/themes/icon.css" />

    <script type="text/javascript" src="js/common.js"></script>

    <script type="text/javascript" src="js/jquery-easyui-1.3.2/jquery-1.8.0.min.js"></script>

    <script type="text/javascript" src="js/jquery-easyui-1.3.2/jquery.easyui.min.js"></script>

    <script type="text/javascript">
        // extend the 'equals' rule  
        $.extend($.fn.validatebox.defaults.rules, {
            equals: {
                validator: function(value, param) {
                    return value == $(param[0]).val();
                },
                message: '前后密码不匹配！'
            }
        });

        function save() {
            var validate = $('#fm').form('validate');
            if (!validate)
                return;
            var oPwd = $('#oPwd').val();
            var pwd = $('#pwd').val();


            WebApp.ResetPwdFrm.ResetPwd(oPwd, pwd, function callback(p) {
                if (p.error) {
                    $.messager.alert('异常消息', '提交保存异常,' + p.error.Message, 'error');
                    return;
                }

                var res = p.value;
                if (res) {
                    var data = res.Data;
                    var msg = res.Msg;
                    if (msg)
                        $.messager.alert('重置密码信息获取异常', msg, 'error');
                    else {
                        if (data == true) {
                            $.messager.alert('消息', '密码已重置!', 'info');
                        }
                        else
                            $.messager.alert('重置密码异常', msg, 'error');
                    }
                }
            });
        }
    </script>

    <style type="text/css">
        .fitem
        {
            margin-bottom: 5px;
        }
        .fitem span
        {
            display: inline-block;
            width: 80px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    </form>
    <div style="padding: 10px">
        <div id="pMain" class="easyui-panel" title="重置密码" style="width: 600px; padding: 10px;
            text-align: center">
            <form id="fm">
            <div class="fitem">
                <span>原密码：</span><input id="oPwd" type="password" class="easyui-validatebox"
                    data-options="required:true" /></div>
            <div class="fitem">
                <span>新密码：</span><input id="pwd" type="password" class="easyui-validatebox"
                    data-options="required:true" /></div>
            <div class="fitem">
                <span>确认新密码：</span><input id="rPwd" type="password" class="easyui-validatebox"
                    required="required" validtype="equals['#pwd']" /></div>
            </form>
        </div>
        <div id="btns" style="width: 600px; padding: 10px; text-align: center">
            <a id="btnSaveBase" href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok"
                onclick="save()">保存修改</a>
        </div>
    </div>
</body>
</html>
